package com.igeek.d0603;

import java.util.*;

/**
 * @Author: zhiyu
 * @Date:18:17
 * @DESC:
 */
public class SetDemo {
    public static void main(String[] args) {
        String str = "aiodjl;hriWFUADJSV123UEHiowfjnivowe";
        count(str);
        String str1 = "8 10 15 5 2 7";
        sortStr(str1);
        rmv();
    }
    public static void count(String str){
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < str.length(); i++) {
            set.add(str.substring(i,i+1));
        }
        System.out.println("set.size() = " + set.size());
        System.out.println("set = " + set);
    }
    public static void sortStr(String str){
        String[] split = str.split(" +");
        TreeSet<Integer> strings = new TreeSet<>();
        for (int i = 0; i < split.length; i++) {
            strings.add(Integer.parseInt(split[i]));
        }
        System.out.println("strings = " + strings);
    }
    public static void rmv(){
        Person p1 = new Person("jack",23);
        Person p2 = new Person("rose",22);
        Person p3 = new Person("diviv",24);
        Person p4 = new Person("diviv",24);
        Person[] people = {p1,p2,p3};
        List<Person> list = Arrays.asList(people);
        HashSet<Person> set = new HashSet<>();
        set.addAll(list);
        System.out.println("set = " + set);
    }
}

